import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter)

// 路由懒加载
const MSite = () => import("../pages/MSite/MSite.vue")
const Search = () => {
  return import("../pages/Search/Search.vue")
}
const Order = () => import("../pages/Order/Order.vue")
const Profile = () => import("../pages/Profile/Profile.vue")
const Login = () => import("../pages/Login/Login.vue")

import Shop from "../pages/Shop/Shop.vue"
import ShopComment from "../pages/Shop/ShopComment/ShopComment.vue"
import ShopGoods from "../pages/Shop/ShopGoods/ShopGoods.vue"
import ShopInfo from "../pages/Shop/ShopInfo/ShopInfo.vue"

export default new VueRouter({
  routes: [
    {
      path: "/msite",
      component: MSite,
      meta: {
        showFooter: true,
      },
    },
    {
      path: "/search",
      component: Search,
      meta: {
        showFooter: true,
      },
    },
    {
      path: "/order",
      component: Order,
      meta: {
        showFooter: true,
      },
    },
    {
      path: "/profile",
      component: Profile,
      meta: {
        showFooter: true,
      },
    },
    {
      path: "/login",
      component: Login,
    },
    {
      path: "/shop",
      component: Shop,
      children: [
        {
          path: "comment",
          component: ShopComment,
        },
        {
          path: "goods",
          component: ShopGoods,
        },
        {
          path: "info",
          component: ShopInfo,
        },
        {
          path: "",
          redirect: "goods",
        },
      ],
    },
    //默认
    {
      path: "/",
      redirect: "/msite",
    },
  ],
})
